﻿using System.Collections.Generic;
using System.Web.Mvc;
using LangMauViet.Models.Entity;
using LangMauViet.Models.Service;

namespace LangMauViet.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            CategoryService s1 = new CategoryService();
            VideoService s = new VideoService();
            List<Video> vlistHot = s.GetVideo(0,1,0,3); //1: download
            List<Video> vlistNew = s.GetVideo(0, 0, 0, 3); //0: moi nhat
            List<HotItem> lvhot = s1.GetHotItem(9);
            List<HotItem> lihot = s1.GetHotItem(1);
            List<HotItem> lnhot = s1.GetHotItem(3);
            ImageService iser = new ImageService();
            List<Images> lImage = iser.GetImages(0,0,0,3);
            NewsService nser = new NewsService();
            List<News> lNews = nser.GetNews(0, 0, 0, 3);
            ViewData["listVideoHost"] = vlistHot;
            ViewData["listVideoNew"] = vlistNew;
            ViewData["listImage"] = lImage;
            ViewData["listNews"] = lNews;
            ViewData["lvhot"] = lvhot;
            ViewData["lihot"] = lihot;
            ViewData["lnhot"] = lnhot;
            //WEB
            List<Video> vlistNoibat = s.GetVideo(0, 3, 0, 6); //3: position ( éo hiểu là gì)
            ViewData["listVideoNoibat"] = vlistNoibat;
            List<Video> vlistVideoNewWeb = s.GetVideo(0, 0, 0, 7); //0: crate date
            ViewData["listVideoNewWeb"] = vlistVideoNewWeb;
            List<Video> vlistVideoXemNhieu = s.GetVideo(0, 1, 0, 20); //1: download
            ViewData["vlistVideoXemNhieu"] = vlistVideoXemNhieu;
            List<Video> vlistHotWeb = s.GetVideo(0, 1, 0, 6); //1: download
            ViewData["listVideoHostWeb"] = vlistHotWeb;

            List<News> vlistNewWeb = nser.GetNews(0, 0, 0, 6); //0: moi nhat
            ViewData["listNewsWeb"] = vlistNewWeb;
            List<Images> lImageWeb = iser.GetImages(0, 0, 0, 6);
            ViewData["listImageWeb"] = lImageWeb;



            return View();
        }

        public ActionResult VideoByCategory()
        {
            CategoryService s1 = new CategoryService();
            List<Category> videoCategory = s1.GetCategory(0, 9);
            ViewData["videoCategory"] = videoCategory;
            //VideoService vs = new VideoService();
            //Video video = vs.GetDetailVideo(videoId);
            //ViewData["DetailVideo"] = video;
            return View();
        }

    }
}
